home *** CD-ROM | disk | FTP | other *** search
/ Programmer Power Tools / Programmer Power Tools.iso / surfmodl / surfm203.arc / SURFSRC.ARC / HIDNLINE.INC < prev    next >
Text File  |  1987-01-05  |  2KB  |  75 lines

  1. procedure HIDDENLINE;
  2.  
  3. { Make a hidden lines drawing of the object }
  4. var Node:                      integer;       { node # }
  5.     Surf:                      integer;       { surface # }
  6.     Cont:                      char;
  7. {$ifndef BIGMEM}
  8.     Surfmin, Surfmax: surfaces;
  9.       { surface minimum & maximum (Ztran) }
  10. {$endif}
  11. label ABORTTEXT,                              { text-mode abort }
  12.       ABORTGRPH;                              { graphics-mode abort }
  13.  
  14. begin
  15. {$ifdef BIGMEM}
  16. with ptra^ do with ptrb^ do with ptrc^ do
  17. with ptrd^ do with ptre^ do with ptrf^ do
  18. with ptri^ do with ptrk^ do
  19. begin
  20. {$endif}
  21.   if (Viewchanged) then begin
  22.     menumsg ('Transforming to 2-D...');
  23.     if (checkey) then goto ABORTTEXT;
  24. { Transform from 3-D to 2-D coordinates }
  25.     setorigin;
  26.     for Node := 1 to Nnodes do
  27.       perspect (Xworld[Node], Yworld[Node], Zworld[Node],
  28.                 Xtran[Node],  Ytran[Node],  Ztran[Node]);
  29.  
  30.     if (checkey) then goto ABORTTEXT;
  31. { Set plotting limits and normalize transformed coords to screen coords }
  32.     perspect (Xfocal, Yfocal, Zfocal, Xfotran, Yfotran, Zfotran);
  33.     if (not setnormal (Xfotran, Yfotran, XYmax)) then begin
  34.       menumsg ('Warning: Focal point outside data limits.');
  35.       writeln;
  36.       write   ('  Press any key ...');
  37.       while (not keypressed) do;
  38.     { Erase the previous message }
  39.       menumsg ('');
  40.       writeln;
  41.       write ('                          ');
  42.     end;
  43.  
  44. { Normalize all the nodes }
  45.     for Node := 1 to Nnodes do
  46.       normalize (Xtran[Node], Ytran[Node], Xfotran, Yfotran, XYmax);
  47.  
  48.     menumsg ('Sorting surfaces...');
  49.     if (checkey) then goto ABORTTEXT;
  50.     minmax (Surfmin, Surfmax, Nsurf);
  51.     shelsurf (Surfmin, Surfmax, Nsurf);
  52.     Viewchanged := FALSE;
  53.   end; { if Viewchanged }
  54.  
  55.   setgmode;
  56.   for Surf := 1 to Nsurf do begin
  57.     if (Nsides = 2) or (Visible (Surf, 1)) then begin
  58.       { First fill the surface in with black }
  59.       fillsurf (Surf, 0, 0);
  60.       { Now draw the border }
  61.       border (Surf, Color[Matl[Surf]]);
  62.     end;
  63.     if (grafstat) then goto ABORTGRPH;
  64.   end; { for Surf }
  65.   drawaxes (Xfotran, Yfotran, XYmax);
  66. { Wait for user keypress to continue }
  67.   continue;
  68.   ABORTGRPH:
  69.   exgraphic;
  70.   ABORTTEXT:
  71. {$ifdef BIGMEM}
  72. end; {with}
  73. {$endif}
  74. end; {procedure HIDDENLINE }
  75.